home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / March 96 / Re Subview Layout < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  2.0 KB  |  [TEXT/ttxt]

  1. Subject:     Re: Subview Layout
  2. Sent:        3/12/96 12:41 PM
  3. Received:    3/12/96 11:52 AM
  4. From:        laurentd@apple.com
  5. Reply-To:    ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8.  
  9. >I have a subclass of FW_CGadget whose subview layout depends on calling
  10. >methods that need a graphic context. FW_CView::CreateSubViews does not
  11. >provide one.
  12. >
  13. >I have seen two strategies to work around the lack of a graphic context:
  14. >defer geometry computations or use a FW_CScreenContext. Both have their
  15. >pros and cons, but I am not sure what they are. And in the case of deferred
  16. >geometry, I am not sure where is the place to do the actual computation.
  17.  
  18. In the current release (d11) you should defer layout management code to
  19. your frame's method AdjustSubViews()  which is called from 
  20. FW_CFrame::FrameShapeChanged.  Although this won't be called the first
  21. time the frame is created when opening a document or a stationary
  22. (except if your code changes the size of the window).
  23.  
  24. For a new frame the right place is to override FW_CFrame::FacetAdded
  25. (or FW_CEmbeddedFrame::FacetAdded).  Call Inherited::FacetAdded first,
  26. this will call your CreateSubView method, and then change your subview 
  27. layout. In FacetAdded use the frame's graphic context for that facet:
  28.  
  29.   FW_CViewContext gc(ev, this, odFacet, NULL);
  30.  
  31. Note: in ODF 1, you won't have to implement CreateSubViews() if you use 
  32. resources and AdjustSubViews() has disappeared.  ODF provides a simple
  33. layout management scheme based on binding flags (left, right, top, bottom,
  34. width and height).  You can override it with your own layout code by
  35. implementing AdjustToNewLayout() in your view classes.
  36. I will check that it allows to do what you asked for.
  37.  
  38. >I think a document on that subject would be a nice addition to ODF in the
  39. >next release.
  40.  
  41. Yes, we have planned a separate Engineering note covering Layout 
  42. management
  43. of views in ODF 1. This will be merged later in the Developer Guide.
  44.  
  45. --Laurent
  46. ODF Team
  47.